# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=rocs
pkgver=22.04.3
pkgrel=0
# armhf blocked by extra-cmake-modules
# s390x blocked by kxmlgui
# riscv64 disabled due to missing rust in recursive dependency
arch="all !armhf !s390x !riscv64"
url="https://kde.org/applications/education/org.kde.rocs"
pkgdesc="Graph Theory IDE"
license="GPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only) AND GFDL-1.2-only"
makedepends="
	boost-dev
	extra-cmake-modules
	grantlee-dev
	karchive-dev
	kconfig-dev
	kcoreaddons-dev
	kcrash-dev
	kdeclarative-dev
	kdoctools-dev
	ki18n-dev
	kitemviews-dev
	ktexteditor-dev
	kxmlgui-dev
	qt5-qtbase-dev
	qt5-qtsvg-dev
	qt5-qtxmlpatterns-dev
	samurai
	"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/rocs-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang $pkgname-dev"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build

	# TestTgfFileFormat, TestRocs1FileFormat, TestRocs2FileFormat, and
	# graphtheory-test_graphoperations are broken
	# TestProject requires OpenGL
	local skipped_tests="("
	local tests="
		TestTgfFileFormat
		TestRocs1FileFormat
		TestRocs2FileFormat
		graphtheory-test_graphoperations
		TestProject"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
8b8bed5cffa687ec7d67fe83f96e4a74ba9d37f6c64d468af2feee2d4991c2a0a941c4225d19ad461dd4d56489d15431d04f460a3765de8d23463a4fc8373138  rocs-22.04.3.tar.xz
"
